#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Created on 2009-10-30

@author: yuchen
'''
import unittest, copy
import gamemodel.board
import gamemodel.player
import gamemodel.state
import gamemodel.piece
import interface.ConsoleAgent
import ai.computer
import ai.human
import basic_elements_test

class Test(unittest.TestCase):
	__board_for_test = None
	__player0 = None
	__player1 = None

	@staticmethod
	def getBoard():
		if Test.__board_for_test == None:
			board = gamemodel.board.CheckerBoard()
			board.setPlayer0(Test.getPlayer0())
			board.setPlayer1(Test.getPlayer1())
			board.reset()
			Test.__board_for_test = board

		return Test.__board_for_test
	
	@staticmethod
	def getPlayer0():
		if Test.__player0 == None:
			Test.__player0 = gamemodel.player.CheckerPlayer('anch')
		return Test.__player0
	
	@staticmethod
	def getPlayer1():
		if Test.__player1 == None:
			Test.__player1 = gamemodel.player.CheckerPlayer('yu21')
		return Test.__player1
	
	@staticmethod
	def isMicroMoveInCheckerMoves(micro_move, checker_moves):
		for checker_move in checker_moves:
				for tmp_micro_move in checker_move.list:
					if tmp_micro_move == micro_move:
						return True
		return False
		

if __name__ == "__main__":
	#import sys;sys.argv = ['', 'Test.testBoard']
	unittest.main()